USE [spa]
GO

/****** Object:  Table [dbo].[horario_terapeuta]    Script Date: 08/26/2012 19:37:49 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[horario_terapeuta](
	[idHorario] [int] IDENTITY(1,1) NOT NULL,
	[terapeuta] [int] NULL,
	[fecha] [date] NULL,
	[desde1] [int] NULL,
	[hasta1] [int] NULL,
	[desde2] [int] NULL,
	[hasta2] [int] NULL,
 CONSTRAINT [PK_horario_terapeuta] PRIMARY KEY CLUSTERED 
(
	[idHorario] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** HASTA ACA TABLA HORARIO TERAPEUTA ******/

USE [spa]
GO

/****** Object:  Table [dbo].[reserva]    Script Date: 08/26/2012 19:38:47 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[reserva](
	[idReserva] [int] IDENTITY(1,1) NOT NULL,
	[tratamiento] [int] NOT NULL,
	[terapeuta] [int] NOT NULL,
	[gabinete] [int] NOT NULL,
	[usuario] [int] NOT NULL,
	[usuarioModificacion] [int] NULL,
	[cliente] [int] NULL,
	[comprobante] [int] NULL,
	[estado] [int] NULL,
	[fechaReserva] [date] NOT NULL,
	[fechaCreacion] [date] NOT NULL,
	[horaReserva] [time](7) NOT NULL,
	[horaCreacion] [time](7) NOT NULL,
	[numeroHabitacion] [int] NULL,
 CONSTRAINT [PK_reserva] PRIMARY KEY CLUSTERED 
(
	[idReserva] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[reserva]  WITH CHECK ADD  CONSTRAINT [FK_reserva_comprobante] FOREIGN KEY([comprobante])
REFERENCES [dbo].[comprobante] ([idComprobante])
GO

ALTER TABLE [dbo].[reserva] CHECK CONSTRAINT [FK_reserva_comprobante]
GO

ALTER TABLE [dbo].[reserva]  WITH CHECK ADD  CONSTRAINT [FK_reserva_gabinete] FOREIGN KEY([gabinete])
REFERENCES [dbo].[gabinete] ([idGabinete])
GO

ALTER TABLE [dbo].[reserva] CHECK CONSTRAINT [FK_reserva_gabinete]
GO

ALTER TABLE [dbo].[reserva]  WITH CHECK ADD  CONSTRAINT [FK_reserva_PMS] FOREIGN KEY([cliente])
REFERENCES [dbo].[PMS] ([idPms])
GO

ALTER TABLE [dbo].[reserva] CHECK CONSTRAINT [FK_reserva_PMS]
GO

ALTER TABLE [dbo].[reserva]  WITH CHECK ADD  CONSTRAINT [FK_reserva_Terapeuta] FOREIGN KEY([terapeuta])
REFERENCES [dbo].[Terapeuta] ([idTerapeuta])
GO

ALTER TABLE [dbo].[reserva] CHECK CONSTRAINT [FK_reserva_Terapeuta]
GO

ALTER TABLE [dbo].[reserva]  WITH CHECK ADD  CONSTRAINT [FK_reserva_tratamiento] FOREIGN KEY([tratamiento])
REFERENCES [dbo].[tratamiento] ([idTratamiento])
GO

ALTER TABLE [dbo].[reserva] CHECK CONSTRAINT [FK_reserva_tratamiento]
GO

ALTER TABLE [dbo].[reserva]  WITH CHECK ADD  CONSTRAINT [FK_reserva_usuario] FOREIGN KEY([usuario])
REFERENCES [dbo].[usuario] ([idUsuario])
GO

ALTER TABLE [dbo].[reserva] CHECK CONSTRAINT [FK_reserva_usuario]
GO

ALTER TABLE [dbo].[reserva]  WITH CHECK ADD  CONSTRAINT [FK_reserva_usuario1] FOREIGN KEY([usuarioModificacion])
REFERENCES [dbo].[usuario] ([idUsuario])
GO

ALTER TABLE [dbo].[reserva] CHECK CONSTRAINT [FK_reserva_usuario1]
GO

